//- Copyright (C) 2023 Beijing Huaxia Chunsong Technology Co., Ltd.
//- <https://www.chatopera.com>, Licensed under the Chunsong Public
//- License, Version 1.0  (the "License"), https://docs.cskefu.com/licenses/v1.html
//- Unless required by applicable law or agreed to in writing, software
//- distributed under the License is distributed on an "AS IS" BASIS,
//- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//- See the License for the specific language governing permissions and
//- limitations under the License.
//- Copyright (C) 2018-Jun. 2023 Chatopera Inc, <https://www.chatopera.com>
//- Licensed under the Apache License, Version 2.0
//- http://www.apache.org/licenses/LICENSE-2.0
mixin dicSelect(dicList, name, value, attr, style)
    -
        attr.style = style;
        var id = name.replace('.', '_')
    input(type="hidden", name=name + ".text", id=id + "_text")
    select(id=id, name=name, old=value, onChange="$('#" + id + "_text').val($(this).find('option:selected').text())")&attributes(attr)
        option(value="") 请选择...
        if dicList
            for dic in dicList
                option(value=(dic.discode ? dic.code : dic.id), selected=dic.id == value || dic.code == value)= dic.name

//- 系统词典Select
mixin sysDicSelect(code, name, value, attr, style)
    +dicSelect(uKeFuDic[code],name,value,attr,style)

mixin subSelect(macroSysDicList, name, value, attr, style)
    -
        style = style ? style : '';
        var id = name.replace('.', '_')
    input(type="hidden", name=name + ".text", id=id + "_text")
    select(id=id, name=name, onChange="$('#" + id + "_text').val($(this).find('option:selected').text())", style=style)&attributes(attr)
        option(value="") 请选择...
        if macroSysDicList
            for dic in macroSysDicList
                option(value=(dic.discode ? dic.code : dic.id), selected=dic.id == value || dic.code == value)= dic.name

